home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
menus
/
mxmnu241.zip
/
MARXCOM.MNU
< prev
next >
Wrap
Text File
|
1993-01-02
|
6KB
|
304 lines
Comment
==========================================================
Copyright 1992 by Marc Perkel * All right reserved.
This program is a sample communications program in Marxmenu.
It isn't as good as Procomm, but it isn't half bad for a few
pages of code.
=========================================================
EndComment
Var
InitString
Compuserve
StartTime
LastFile
SendingFile
Setup
ComPort = Com2 ;your com port
InitString = 'ATZ' ;your init string
Compuserve = False ;set to true if accessing Compuserve
ComInitPort(38400,8,'N',1)
ComHangupOnExit Off
if Compuserve
ComStripHighBit
ComBPlus
endif
Writeln 'MarxCom * Copyright 1992 by Marc Perkel'
Writeln
Writeln 'Alt-X to Exit * Alt-H to HangUp * PgUp to Upload * PgDn to Download
Writeln
ComWrite InitString CR
Terminal
;----- Set up Communications
Procedure Setup
Explode Off
ClearScreenOnExit Off
BlankTime = 0
Mouse Off
NoBoxBorder
AnsiWindows
DrawBox 1 1 ScreenWidth ScreenHeight
WordStarKeys Off
{Set up event logic}
KeyEvent(PgDnKey) = loc DownLoad
KeyEvent(PgUpKey) = loc UpLoad
KeyEvent(AltX) = loc ExitProgram
KeyEvent(AltH) = loc Hangup
ComXmitAbortProgram = loc XmitAbort
ComXmitStatusProgram = loc XmitStatus
EndProc
;----- This is the main terminal loop
Procedure Terminal
while True
Cursor On
if KbdReady then ComWrite(ReadKey)
if ComCharReady then Write(ComReadChar)
endwhile
EndProc
;----- Exit the Menu
Procedure ExitProgram
ExitMenu
EndProc
;----- Download Menu
Procedure DownLoad
var FileName Proto
Proto = PickProtocol
if Proto = Esc
Return
elseif Proto = '1'
FileName = AskForFileName
if FileName = '' then return
ComRecXModem(FileName)
elseif Proto = '2'
FileName = AskForFileName
if FileName = '' then return
ComRec1kXModem(FileName)
elseif Proto = '3'
ComRecYModem
elseif Proto = '4'
ComRecYModemG
elseif Proto = '5'
ComRecZModem
elseif Proto = '6'
ComRecKermit
endif
if ComResult <> 0
Writeln 'Error Status: ' ComResult
Wait 400
endif
EndProc
;----- UpLoad Menu
Procedure UpLoad
var FileName Proto
FileName = AskForFileName
if (FileName > '') and ExistFile(FileName)
Proto = PickProtocol
if Proto = Esc then Return
SendingFile
FileName = CleanFileName(FileName)
Writeln
if Proto = '1'
ComSendXModem(FileName)
elseif Proto = '2'
ComSend1kXModem(FileName)
elseif Proto = '3'
ComSendYModem(FileName)
elseif Proto = '4'
ComSendYModemG(FileName)
elseif Proto = '5'
ComSendZModem(FileName)
elseif Proto = '6'
ComSendKermit(FileName)
endif
endif
SendingFile Off
EndProc
Procedure AskForFileName
var FileName
DoubleLineBox
BoxBorderColor LCyan Mag
BoxInsideColor Yellow Mag
InverseColor Yellow Red
DrawBox 10 20 40 3
Write ' FileName: '
FileName = Readln
EraseTopWindow
Return FileName
EndProc
Procedure PickProtocol
var Ch
DoubleLineBox
BoxBorderColor LCyan Mag
BoxInsideColor Yellow Mag
InverseColor Yellow Red
DrawBox 50 7 20 8
UseArrows On
Writeln ' 1 - XModem'
Writeln ' 2 - XModem 1k'
Writeln ' 3 - YModem'
Writeln ' 4 - YModem G'
Writeln ' 5 - ZModem'
Write ' 6 - Kermit'
Ch = ReadKey
UseArrows Off
EraseTopWindow
Return Ch
EndProc
;----- Hangup Modem
Procedure HangUp
Writeln
Writeln
Writeln 'Hanging Up'
Writeln
ComDTR Off
Wait 50
ComDTR
EndProc
;----- ESC aborts UpLoad or Download
Procedure XmitAbort
var Ch
if not ComCD then Return True
if not KbdReady then Return False
Ch = ReadKey
if Ch <> Esc then Return False
Return True
EndProc
;----- Display file transfer status
Procedure XmitStatus
var Progress BarSize X
if ComXmitStarting
DoubleLineBox
BoxBorderColor LCyan Mag
BoxInsideColor White Mag
BoxHeaderColor Yellow Cyan
BoxHeader ' Transfer Status - ' + ComProtocol + ' '
if SendingFile
DrawBox 43 6 35 10
else
DrawBox 43 6 35 11
endif
elseif ComXmitEnding
EraseTopWindow
LastFile = ''
else
BarSize = 37
if ComFileName <> LastFile
LastFile = ComFileName
StartTime = Now
endif
GotoXY 1 1
Write ' File Name: ' ComFileName
ClearLine
Writeln
Write ' Bytes Transferred: ' ComBytesTransferred
ClearLine
Writeln
Write ' Bytes Remaining: ' ComBytesRemaining
ClearLine
Writeln
if not SendingFile
Write ' CPS: '
if Now > StartTime
X = ComBytesTransferred / (Now - StartTime)
if X > 0
X = X / (X / 20) * (X / 20)
endif
Write X
else
Write '0'
endif
ClearLine
Writeln
endif
Write ' File Size: ' ComFileSize
ClearLine
Writeln
Write ' Block Size: ' ComBlockSize
ClearLine
Writeln
Write ' Block Errors: ' ComBlockErrors
ClearLine
Writeln
Write ' Total Errors: ' ComTotalErrors
ClearLine
if ComFileSize > 0
Progress = ComBytesTransferred * BarSize / ComFileSize
endif
if ComFileSize > 0
Writeln
Write ' Progress: ['
if ColorScreen then TextColor Cyan Mag
Loop Progress / 2
Write '█'
endloop
if Progress mod 2 = 0
Write ' '
else
Write '▌'
endif
Loop Max(BarSize - Progress / 2 - 1,0)
Write ' '
endloop
TextColor White Mag
Write ']'
ClearLine
endif
endif
EndProc